<template>
    <form @submit="formSubmit" report-submit='true' class="layout">
        <button formType="submit" class="button" hover-class="none">
            <view class="fixed">
                <slot></slot>
            </view>
        </button>
    </form>
</template>

<script>
import {
    request
} from "../../comon/js/request.js"
export default {
    name: "getFormId",
    data() {
        return {
            isClick: true
        }
    },
    methods: {
        formSubmit: function (e) {
            if (this.isClick) {
                this.isClick = false
                setTimeout(() => {
                    this.isClick = true
                }, 3000);
                let token = uni.getStorageSync("token")
                let formId = e.detail.formId
                let wxOpenid = uni.getStorageSync("wx_openid")
                console.log(wxOpenid)
                request({
                    url: "v1/wxForm/formId",
                    data: {
                        openid: wxOpenid,
                        formId: formId
                    },
                    method: "POST",
                }).then(res => {
                    console.log(res)
                })
            }
        }
    }
}
</script>

<style scoped>
.layout {
    display: inline-block;
    padding-left: 0;
    padding-right: 0;
    box-sizing: border-box;
    font-size: inherit;
    text-align: left;
    text-decoration: none;
    line-height: inherit;
    -webkit-tap-highlight-color: transparent;
    color: inherit;
    width: 100%;
    position: relative;
}

.layout .button {
    display: inline-block;
    padding-left: 0;
    padding-right: 0;
    box-sizing: border-box;
    font-size: inherit;
    text-align: left;
    text-decoration: none;
    line-height: inherit;
    background: transparent; 
    -webkit-tap-highlight-color: #000;
    color: inherit;
    width: 100%;
    position: relative;
    border-radius: 0;
}

.layout .button .fixed {
    position: relative;
    z-index: 9999;
    width: 100%;
}

.layout .button:before,
.layout .button:after {
    border-width: 0;
}
</style>
